package com.rmb.common.model.response;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.apache.poi.ss.formula.functions.T;

import java.util.List;


/**
 * @author ZhaoMyYang
 */
@Data
@ToString
@NoArgsConstructor
public class ResponseResult implements Response {

    /**
     * 操作是否成功
     */

    boolean success = SUCCESS;

    /**
     * 操作代码
     */
    int code = SUCCESS_CODE;

    /**
     * 提示信息
     */
    String message;

    public ResponseResult(ResultCode resultCode){
        this.success = resultCode.success();
        this.code = resultCode.code();
        this.message = resultCode.message();
    }

    public ResponseResult(ResultCode resultCode, String message) {
        this.success = resultCode.success();
        this.code = resultCode.code();
        this.message = message;
    }

    public static ResponseResult methodSuccess(){
        return new ResponseResult(CommonCode.SUCCESS);
    }
    public static ResponseResult methodFail(){
        return new ResponseResult(CommonCode.FAIL);
    }
    
    public static ResponseResult methodFail(ResultCode resultCode, String message){
        return new ResponseResult(CommonCode.FAIL,message);
    }
}
